package com.inlycat.web.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.inlycat.entity.Node;
import com.inlycat.service.NodeService;

/**
 * @author jarvan4dev@163.com
 * @since 2015年8月27日下午6:20:16
 * @category
 **/
@Controller
@RequestMapping("/node")
public class NodeContoller {

	@Resource
	private NodeService nodeService;

	@RequestMapping(value = "/select", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> select(Node node) {
		System.out.println(node);
		Map<String, Object> resultMap = new HashMap<String, Object>();
		List<Node> nodes = nodeService.select(node);
		if (nodes == null) {
			resultMap.put("code", 0);
			resultMap.put("message", "未查询到");
			return resultMap;
		}
		resultMap.put("code", 1);
		resultMap.put("message", "success");
		resultMap.put("data", nodes);

		return resultMap;
	}
	
	

}
